﻿<MNavigationDrawer Absolute Temporary Right Value="Show" ValueChanged=ShowChanged Width="420" class="pa-3">
    <MRow>
        <MCol Md="@("auto")" Class="mr-auto">Add Payment</MCol>
        <MCol Md="@("auto")"><MIcon OnClick="()=>{ ShowChanged.InvokeAsync(false);}">mdi-close</MIcon></MCol>
    </MRow>
    <MRow NoGutters class="mt-4">
        <MCol Md="12">
            <MTextField TValue="string" Label="Invoice Balance" Disabled Outlined Dense></MTextField>
        </MCol>
        <MCol Md="12">
            <MTextField TValue="string" Label="Payment Amount" Placeholder="$10000" Outlined Dense></MTextField>
        </MCol>
        <MCol Md="12">
            <MMenu @bind-Value="_dateMenu"
                   CloseOnContentClick="false"
                   Transition="scale-transition"
                   OffsetY
                   MaxWidth="290"
                   MinWidth="@("auto")">
                <ActivatorContent>
                    <MTextField Value="Date"
                                Label="Payment Date"
                                PersistentHint
                                Readonly Outlined Dense
                                @attributes="context.Attrs"></MTextField>
                </ActivatorContent>
                <ChildContent>
                    <MDatePicker @bind-Value="Date" OnInput="()=>_dateMenu=false" NoTitle></MDatePicker>
                </ChildContent>
            </MMenu>
        </MCol>
        <MCol Md="12">
            <MSelect @bind-Value="@_paymentMethod"
                     Label="Payment Method"
                     Outlined Dense
                     Items="@_paymentMethods"
                     ItemText="u => u"
                     ItemValue="u => u">
            </MSelect>
        </MCol>
        <MCol Md="12">
            <MTextarea Outlined Label="Internal Payment Note" Placeholder="Internal Payment Note">
            </MTextarea>
        </MCol>
        <MCol Md="12" class="mt-3">
            <MButton class="primary">Send</MButton>
            <MButton Outlined>Cancel</MButton>
        </MCol>
    </MRow>
</MNavigationDrawer>

@code {
    private bool _dateMenu;
    private string _paymentMethod = "";
    private List<string> _paymentMethods = InvoiceService.GetpaymentMethodList();

    [Parameter]
    public bool? Show { get; set; } = false;

    [Parameter]
    public EventCallback<bool?> ShowChanged { get; set; }
    
    private DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now);
}